package com.tcd.web.controller;


import com.tcd.pojo.Claims;
import com.tcd.service.ClaimsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

import java.util.List;

/**
 * <p>
 * 理算表 前端控制器
 * </p>
 *
 * @author space
 * @since 2021-05-27
 */
@RestController
@RequestMapping("/claims")
@CrossOrigin
public class ClaimsController {
    @Autowired
    ClaimsService claimsService;

    @RequestMapping("/getClaims")
    public List<Claims> getClaims(@RequestParam(defaultValue = "1") Integer pageIndex,@RequestParam(defaultValue = "10") Integer pageSize, Integer claimsNumber, Integer warrantyId, String claimsType, String state){
        return claimsService.getClaims(pageIndex,pageSize,claimsNumber,warrantyId,claimsType,state);
    }

    @RequestMapping("/getClaimsCount")
    public Integer getClaimsCount(Integer claimsNumber, Integer warrantyId, String claimsType, String state){
        return claimsService.getClaimsCount(claimsNumber, warrantyId, claimsType, state);
    }

    @RequestMapping("/addClaims")
    public Integer addClaims(@RequestBody Claims claims) {
        return claimsService.addClaims(claims);
    }

    @RequestMapping("/updateClaims")
    public Integer updateClaims(@RequestBody Claims claims){
        return claimsService.updateClaims(claims);
    }
}

